home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / GRAPHICS.SWG / 0110_FONTS WITH TURBOPASCAL V7.pas < prev    next >
Pascal/Delphi Source File  |  1994-08-24  |  2KB  |  77 lines

  1.  
  2. {compile the *.bgi and *.chr files into a .exe file?  If so how?
  3.  
  4. 1. Collect all the fonts you can
  5.    If you don't have them all, fake it (use old one in place of real one)
  6. 2. Compile them separately into OBJ files
  7.    example: binobj bold.chr bold.obj bold
  8.  
  9. 3. DO the BGI driver for your video card.
  10.    example: binobj egavga.bgi egavga.obj egavga
  11.  
  12. 4. use the TPUs in your main prog
  13. 5. Load the video driver like an external procedure;
  14.  
  15.  
  16. {-------------------------------example 1 (converts chr->obj->tpu)}
  17.  
  18. unit boldfont;   {use the name + font for all of the fonts}
  19.  
  20. interface
  21. procedure bold;
  22. implementation
  23. procedure bold; external;
  24. {$L bold.obj}
  25. end.
  26. {------------------------------------------------------------------------}
  27.  
  28. {--------------------------------example 2}
  29. uses graph,
  30.    boldfont, eurofont, gothfont, lcomfont, littfont,
  31.    sansfont, simpfont, scrifont, tripfont, tscrfont;
  32.  
  33. procedure egavga; external;
  34. {$L egavga.obj}
  35.  
  36. const
  37.    xFonts : array[0..10] of record
  38.       sFontName  : string;
  39.       xpFontAddr : pointer;
  40.    end =
  41.    ( {Fonts must remain in this order because of settextstyle()}
  42.    (sFontName :'Default'; xpFontAddr : nil),  {style 00}
  43.    (sFontName :'Triplex'; xpFontAddr : @TRIP),{style 01}
  44.    (sFontName :'Small';   xpFontAddr : @LITT),{style 02}
  45.    (sFontName :'Sans';    xpFontAddr : @SANS),{style 03}
  46.    (sFontName :'Gothic';  xpFontAddr : @GOTH),{style 04}
  47.    (sFontName :'Script';  xpFontAddr : @SCRI),{style 05}
  48.    (sFontName :'Simplex'; xpFontAddr : @SIMP),{style 06}
  49.    (sFontName :'Tscr';    xpFontAddr : @TSCR),{style 07}
  50.    (sFontName :'Lcom';    xpFontAddr : @LCOM),{style 08}
  51.    (sFontName :'Euro';    xpFontAddr : @EURO),{style 09}
  52.    (sFontName :'Bold';    xpFontAddr : @BOLD) {style 10}
  53.    );
  54.  
  55. var
  56.    gd, gm, i : integer;
  57.  
  58. begin
  59.    if RegisterBGIDriver(@EGAVGA) < 0 then halt;
  60.    for i := 1 to 10 do
  61.       if RegisterBGIFont(xFonts[i].xpFontAddr) < 0 then
  62.          write('Can''t register', xFonts[i].sFontName,' font');
  63.  
  64.    gd := VGA;
  65.    gm := VGAHi;
  66.    initgraph(gd, gm, '');
  67.  
  68.    for i := 0 to 10 do
  69.       begin
  70.          settextstyle(i,0,10);
  71.          outtextxy(10,20,xFonts[i].sFontName);
  72.          readln;
  73.          cleardevice;
  74.       end;
  75.    closegraph;
  76. end.
  77.